#字典
# 字典是一种存储 键值对 的结构


# 字典本质上是一个 哈希表, 哈希表的 key 要求是 "可哈希的", 也就是可以计算出一个哈希值.
# 可以使用 hash 函数计算某个对象的哈希值.
# 但凡能够计算出哈希值的类型, 都可以作为字典的 key
#创建字典的两种方式
# a={}
# b=dict()
# print(type(a))
# print(type(b))
#
# student={
#     'id':1,
#     'name':'张三'
# }
# print(student)



# student={
#     'id':1,
#     'name':'zhangsan'
# }
# print('id' in student)
# print('score' in student)

# print(student['id'])
# print(student['name'])
# # print(student['score'])
#
# student['score']=90
# print(student)
# student.pop('score')
# print(student)


# student={
#     'id':1,
#     'name':'zhangsan',
#     'score':80
# }
# # for key in student:
# #     print(key,student[key])
# # print(student.keys())
# # print(student.values())
# # print(student.items())
# # for elem in student.items():
# #     print(elem)
#
# print(hash(0))
# print(hash(3.14))
# print(hash('hello'))
# print(hash(True))
# print(hash(()))
#
# print(hash([1, 2, 3]))
# print(hash({'id':1}))



